SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [Valcomm].[IC_MiscData] (@FundId AS VARCHAR (10)) AS
BEGIN
DECLARE @ExportId INT = (SELECT MAX(ExportId) FROM [FSFundModel_IC].Reporting.Export WHERE FundId = @FundId)

DECLARE @ReportDate AS DATE = (
				SELECT CAST(MAX([NAVDate]) AS DATE) FROM [FSFundModel_IC].[Reporting].[Export] e WHERE [e].[FundId] = @FundId
)

DECLARE @LastValcomDate AS DATE = '12/31/2013'

-- (
--				SELECT CAST(MAX([NAVDate]) AS DATE) FROM [FSFundModel_IC].[Reporting].[Export] e WHERE [e].[FundId] = @FundId AND [e].[ExportType] = 'VALCOMM'

--)
DECLARE @3MLibor AS DECIMAL(38,10) = (
SELECT [r].[RatePct] FROM  [FSFundModel_IC].[dbo].[Rate] r  WHERE [r].[RateDate] = @ReportDate AND [r].[BaseRateType] = 'LIBOR3Month'

)


SELECT @ReportDate AS ReportDate, @LastValcomDate AS LastValcommDate, @3MLibor AS LIBOR3M
END

GO
